package com.example.appkcsj.slice;

import com.example.appkcsj.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.aafwk.content.Operation;
import ohos.agp.components.Button;
import ohos.agp.components.Component;
import ohos.agp.components.Text;

public class gerenzhongxinAbility2Slice extends AbilitySlice implements Component.ClickedListener {
    //Button newbuild;

    Text chakan;
    Text help;
    Text guanyu;
    Text vip;

    Button book;
    Button edit;
    Button people;
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_gerenzhongxin2);
        //newbuild = (Button) findComponentById(ResourceTable.Id_newbuild);
       // newbuild.setClickedListener(this);


        chakan  = (Text) findComponentById(ResourceTable.Id_chakan);
        chakan.setClickedListener(this);
        help= (Text) findComponentById(ResourceTable.Id_help);
        help.setClickedListener(this);
        vip= (Text) findComponentById(ResourceTable.Id_vip);
        vip.setClickedListener(this);
        guanyu= (Text) findComponentById(ResourceTable.Id_guanyu);
        guanyu.setClickedListener(this);


        book = (Button) findComponentById(ResourceTable.Id_book);
        book.setClickedListener(this);
        edit = (Button) findComponentById(ResourceTable.Id_edit);
        edit.setClickedListener(this);
        people = (Button) findComponentById(ResourceTable.Id_people);
        people.setClickedListener(this);
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }

    @Override
    public void onClick(Component component) {
        if (component == chakan) {
            //跳查看页
            Intent i = new Intent();
            Operation operation = new Intent.OperationBuilder().withDeviceId("")
                    .withBundleName("com.example.appkcsj")
                    .withAbilityName("com.example.appkcsj.seventhAbility")
                    .build();
            i.setOperation(operation);
            startAbility(i);
        }
        if (component == help) {
            //跳到帮助反馈页
            Intent i = new Intent();
            Operation operation = new Intent.OperationBuilder().withDeviceId("")
                    .withBundleName("com.example.appkcsj")
                    .withAbilityName("com.example.appkcsj.gehelpAbility2")
                    .build();
            i.setOperation(operation);
            startAbility(i);
        }

        if (component == vip) {
            //跳到注册页
            Intent i = new Intent();
            Operation operation = new Intent.OperationBuilder().withDeviceId("")
                    .withBundleName("com.example.appkcsj")
                    .withAbilityName("com.example.appkcsj.gevipAbility2")
                    .build();
            i.setOperation(operation);
            startAbility(i);
        }

        if (component == guanyu) {
            //跳到注册页
            Intent i = new Intent();
            Operation operation = new Intent.OperationBuilder().withDeviceId("")
                    .withBundleName("com.example.appkcsj")
                    .withAbilityName("com.example.appkcsj.geOwnAbility2")
                    .build();
            i.setOperation(operation);
            startAbility(i);
        }



        if (component == edit) {
            //跳到注册页
            Intent i = new Intent();
            Operation operation = new Intent.OperationBuilder().withDeviceId("")
                    .withBundleName("com.example.appkcsj")
                    .withAbilityName("com.example.appkcsj.fourthAbility")
                    .build();
            i.setOperation(operation);
            startAbility(i);
        }

        if (component == book) {
            //跳到注册页
            Intent i = new Intent();
            Operation operation = new Intent.OperationBuilder().withDeviceId("")
                    .withBundleName("com.example.appkcsj")
                    .withAbilityName("com.example.appkcsj.thirdAbility")
                    .build();
            i.setOperation(operation);
            startAbility(i);
        }
        if (component == people) {
            //跳到注册页
            Intent i = new Intent();
            Operation operation = new Intent.OperationBuilder().withDeviceId("")
                    .withBundleName("com.example.appkcsj")
                    .withAbilityName("com.example.appkcsj.gerenzhongxinAbility2")
                    .build();
            i.setOperation(operation);
            startAbility(i);
        }



    }
}
